package com.example.teesystem.mapper;

import com.example.teesystem.entity.PreCourseScore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.teesystem.entity.vo.preCourseScore.PreCourseResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
* @author 12510
* @description 针对表【t_pre_course_score】的数据库操作Mapper
* @createDate 2022-05-27 11:15:24
* @Entity com.example.teesystem.entity.PreCourseScore
*/
@Mapper
public interface PreCourseScoreMapper extends BaseMapper<PreCourseScore> {

    @Select("select id from t_pre_course_score where student_id = #{studentId} and pre_course = #{preCourse} and is_delete = 0")
    Integer getPreCourseScore(int studentId, int preCourse);

    @Update("update t_pre_course_score set score = #{preCourseScore} where id = #{id}")
    void updatePreCourseScore(int preCourseScore, int id);

    @Select("select * from t_pre_course_score where student_id = #{studentId} and course_id = #{courseId} and is_delete = 0")
    List<PreCourseScore> getPreCourseScores(int studentId, int courseId);
}




